{% extends "base.html" %}
{%block scripts %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/ceomment_script.js"></script>
<script type="text/javascript">
window.onload=function()
{
	var deftxt='Enter the the content of your post here.';
	var def=document.getElementById('content');
	def.onfocus = function()
	{this.value=(this.value==deftxt)?'':this.value;}
	def.onblur= function()
	{if(this.value=='')	{this.value=deftxt;}
	else this.value;}
	def.focus();
	def.blur();
}
</script>
{%endblock%}
{%block title%}Phillip's Eportfolio - {{post.title}}{%endblock%}
{%block content%}
		<span class="b_title_text">Phillip's Blog - {{post.title}}</span><br />
		<span class="b_date_text">Posted on {{post.creation_date|date}} at {{post.creation_date|time}}</span>
		<br /><br />
		<span class="b_content">
			{{post.content|safe}}
			<br />
		</span>
		<br />
		{% if post.comments_allowed %}
		<div id="comment_container">
			{% for comments in comment %}
				<span class="c_head">Comment from {{comments.name}}</span><br />
				<span class="c_time">Posted on {{comments.creation_date|date}} at {{comments.creation_date|time}}</span> <br />
				<span class="c_body">{{comments.content}}</span>
				{% if valid %}
					<br /><br />
				 	<a class="c_a_text" href="http://localhost:8000/blog/comments/{{post.id}}/delete/{{comments.id}}/" onclick="return confirm('Are you sure you want to delete this comment?');">Delete Comment</a>
				{% endif %}
				<br /><br />
			{% endfor %}
			<div id="new_c_box">
				<div id="comment_form_container">
					{% if comment_success %}
						<span class="c_main_head">Comment Successfully Posted!</span><br />
					{% endif %}
					{% if not comment_success %}
					<span class="c_main_head">Post a comment</span><br />
					<form action="http://localhost:8000/blog/comments/add/{{post.id}}/" method="post" id="comment_form">
						<div id="left_comment_wall">
							<div id="form_descr">Name: </div>
							<div id="form_descr_b">Email: </div>
							<div id="form_descr_b">Comment: </div>
						</div>
						<div id="right_comment_wall">
							<input type="text" name="name" class="text" /><br />
							<input type="text" name="email" class="text"/><br />
							<textarea id="content" class="text" name="content" rows="4" cols="30"></textarea><br />			
							<input type="submit" value="Post Comment" name="submit" id="submit_bt" />
						</div>
						<div id="comment_clear"></div>
						</div>
					</form>
					{% endif %}
			</div>
		</div>
		{%endif%}
		<br />
		<a class="b_a_text" href="http://c-pj.net/blog">Back to the Blog</a>
		<br /><br />
		{% if valid %}
		 	<a class="b_a_text" href="http://c-pj.net/admin/blog/post/{{post.id}}/">Edit Post</a>
		{% endif %}
{%endblock%}
